<?php
class Relevant_House_Model extends CI_Model{
	
	function getRelevantHouses(){
		$sql = 'select h.*, hi.path from house h ' +
				'join relevant_house relevant on h.house_id = relevant.house_id ' +
				'join house_image hi on h.main_image_id = hi.house_image_id';
		$q = $this->db->query($sql);
		if ($q->row_num() > 0){
			foreach($q.result() as $row){
				$data[] = $row;
			}
			return $data;
		}
	}
}